package com.yc.cloud.api.enums;

import lombok.Getter;

/**
 * 告警等级枚举
 */
@Getter
public enum AlarmLevelEnum {
    
    NORMAL(1, "一般"),
    WARNING(2, "警告"),
    EMERGENCY(3, "紧急");
    
    private final int value;
    private final String desc;
    
    AlarmLevelEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }
    
    public static AlarmLevelEnum getByValue(Integer value) {
        if (value == null) {
            return null;
        }
        
        for (AlarmLevelEnum level : AlarmLevelEnum.values()) {
            if (level.getValue() == value) {
                return level;
            }
        }
        
        return null;
    }
}